<html class="hb-loaded">
 <head> 
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type" /> 
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" /> 
  <meta content="yes" name="apple-mobile-web-app-capable" /> 
  <meta content="black" name="apple-mobile-web-app-status-bar-style" /> 
  <meta content="telephone=no" name="format-detection" /> 
  <meta content="email=no" name="format-detection" /> 
  <title>商品详情</title> 
 
  <script src="js/jquery.min.js"></script> 
  <script src="js/bootstrap.min.js"></script> 
  <link rel="stylesheet" href="css/bootstrap.min.css" /> 
  <link rel="stylesheet" href="css/public.v20150930.css" /> 
  <script src="js/ygop.ajax.client.js"></script> 
  <script src="js/Common.v150812.js"></script> 
  <script src="js/layer.m.js"></script> 
  <link rel="stylesheet" href="css/layer.css" /> 
  <script src="js/jweixin-1.0.0.js" type="text/javascript"></script> 
  <link rel="stylesheet" href="css/gps.css" /> 




 </head> 
 <body> 
  <link rel="stylesheet" href="css/product.css" /> 
  <link rel="stylesheet" href="css/swiper.min.css" /> 
  <script src="js/swiper.min.js"></script> 
  <style>
    .swiper-container {
        width: 100%;
        height: 100%;
    }

    .swiper-slide {
        text-align: center;
        font-size: 18px;
        background: #fff;
        /* Center slide text vertically */
        display: -webkit-box;
        display: -ms-flexbox;
        display: -webkit-flex;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        -webkit-align-items: center;
        align-items: center;
    }

    .returns {
        z-index: 11;
    }
</style> 
  <div class="wrap"> 
   <div style="height:200px" class="pic_slider"> 
    <div style="display:none" class="returns" id="divReasonToReturn">
     支持七天无理由退换货
    </div> 
    <div style="background:#eee" class="swiper-container swiper-container-horizontal"> 
     <div id="divImgList" class="swiper-wrapper">
      <div class="swiper-slide swiper-slide-active" style="width: 1663px;">
       <img class="swiper-lazy swiper-lazy-loaded" id="picFirst0" src="images/441634252785491786.jpg" />
      </div>
      <div class="swiper-slide swiper-slide-next" style="width: 1663px;">
       <img class="swiper-lazy" data-src="images/441634252785753930.jpg" id="picFirst1" />
       <div class="swiper-lazy-preloader"></div>
      </div>
      <div class="swiper-slide" style="width: 1663px;">
       <img class="swiper-lazy" data-src="images/441634252786016074.jpg" id="picFirst2" />
       <div class="swiper-lazy-preloader"></div>
      </div>
     </div> 
     <!-- Add Pagination --> 
     <div class="swiper-pagination">
      <span class="swiper-pagination-bullet swiper-pagination-bullet-active"></span>
      <span class="swiper-pagination-bullet"></span>
      <span class="swiper-pagination-bullet"></span>
     </div> 
    </div> 
   </div> 
   <div class="product-summary"> 
    <div class="product-info"> 
     <div id="divTitle" class="product-name">
      阿拉斯加格陵兰大比目鱼(切段)
     </div> 
     <div class="product-price">
      <span class="price">￥<span id="divPrice">66.00</span></span>
      <del id="divPrice2"></del>
     </div> 
     <div class="quantity"> 
      <a class="decrement" id="decrement">-</a> 
      <input type="text" value="1" class="itxt" id="txtProductCount" /> 
      <a class="increment" id="increment">+</a> 
     </div> 
    </div> 
    <div class="product-choose"> 
     <div class="title">
      规格
     </div> 
     <ul id="divSpec">
      <li commodityid="17feb58e-1b39-47de-a807-87468a5d38f8" commoditycode="156159" class="active"><a>350克/包</a></li>
     </ul> 
    </div> 
    <div style="display:none" class="promotion_list"> 
     <ul id="divPromotions"></ul> 
    </div> 
    <div class="product-other-wrap"> 
     <div class="product-other"> 
      <div class="title">
       信息
      </div> 
      <div> 
       <ul> 
        <li>产地：<span id="spPlaceOfOrigin">美国</span></li> 
        <li>发货地：<span id="spDefaultAreaText"></span></li> 
        <li>结单时间：<span id="spOrderCloseTime">20:00</span></li> 
        <li>发货时间：<span id="spDeliveryTime">2015-10-26</span></li> 
        <li>配送范围：<span id="spDeliveryAreas">上海,北京,江浙,天津,南方,北方,杭州,苏州,昆山,宁波,无锡,廊坊,广州</span></li> 
       </ul> 
       <span class="arrow down">&gt;</span> 
      </div> 
     </div> 
    </div> 
    <div id="divVote" class="comment_link">
     <a>用户评价<span id="spVoteCount">(9)</span><span class="right"><strong><span id="spVotePositiveRate">89%</span></strong>好评</span><span class="arrow">&gt;</span></a>
    </div> 
    <div class="details_link">
     <a id="aProdectDetail" href="/productdetail/17feb58e-1b39-47de-a807-87468a5d38f8">商品图文详情（建议在WIFI下查看）<span class="arrow">&gt;</span></a>
    </div> 
    <div class="cart-btns">
     <a id="btnCart" class="btn-cart">加入购物车</a>
    </div> 
   </div> 
  </div> 
  <script type="text/javascript">
    var commodityId = "";
    var commodityCode = "";
    var maxLimitCount = "";//没有限制数量
    $(function () {
        $(".footer a").removeClass();
        $(".footer #category").addClass("current");
        commodityCode = "156159";
        //加载商品
        getProduct();
        //加减号操作
        updateAmountOperate();
        //点击用户评价
        $("#divVote").click(function () {
            window.location.href = "/comment/" + commodityId;
        });
    })

    //地址下拉显示效果
    $('.product-other-wrap').click(function () {
        if ($(this).hasClass('active')) {
            $(this).removeClass('active');
        } else {
            $(this).addClass('active');
        }
    });

    //添加购物车操作
    function addCart() {
        $("#btnCart").click(function () {
            var amount = 1
            try {
                amount = parseInt($("#txtProductCount").val());
            }
            catch (e) {
                YgmJsCommon.popups.alert("您添加商品数量不正确,请重新设置商品数量");
                $("#txtProductCount").focus();
                return;
            }
            if (!$.isNumeric(amount)) {
                YgmJsCommon.popups.alert("商品数量格式不正确");
                $("#txtProductCount").focus();
                return;
            }
            if (amount < 1) {
                YgmJsCommon.popups.alert("请输入正确的数量");
                $("#txtProductCount").focus();
                return;
            }
            var cartAmount = YgmJsCommon.getCartProductAmountById(commodityId);
            var totalAmount = cartAmount + amount;
            if (totalAmount > maxLimitCount) {
                YgmJsCommon.popups.alert("最大购买数量不能超过" + maxLimitCount);
                return;
            }
            if (amount > maxLimitCount) {
                YgmJsCommon.popups.alert("最大购买数量不能超过" + maxLimitCount);
                $("#txtProductCount").focus();
                return;
            }
            if (amount > 99) {
                YgmJsCommon.popups.alert("商品数量输入过大");
                $("#txtProductCount").focus();
                return;
            }

            var commodity = {};
            commodity.Id = commodityId;
            commodity.Code = commodityCode;
            commodity.Amount = amount;
            commodity.GId = "";
            var bl = YgmJsCommon.updateCartProcuct(commodity, 3);
            if (bl) {
                //返回商品数量显示在footer上
                //var count = YgmJsCommon.getCartProductsTotalCount();
                //$("#fCartProductTotalCount").html(count);
                var count = getCartCount();
                if (count > 0) {
                    YgmJsCommon.popups.tag("商品添加成功");
                }
            }
        });
    }

    //规格操作
    function specOperate() {
        $("#divSpec").find("li").each(function (i, n) {
            $(this).click(function () {
                $("#divSpec").find("li").removeClass();
                //不通规格的同一商品的id不一样
                commodityId = $(this).attr("commodityId");
                commodityCode = $(this).attr("commodityCode");
                window.location.href = "/product/" + commodityCode + ".html";
            })
        })
    }

    //加减商品数量操作
    function updateAmountOperate() {
        //加操作
        $("#increment").click(function () {
            var amount = parseInt($("#txtProductCount").val());
            if (amount > 98) {
                return;
            }
            var num = amount + 1;
 
            $("#txtProductCount").val(num);
        });

        //减操作
        $("#decrement").click(function () {
            var amount = parseInt($("#txtProductCount").val());
            var num = amount - 1;
            if (num <= 0) {
                return;
            }
   
            $("#txtProductCount").val(num);
        });
    }


    //获取商品
    function getProduct() {
        var data = {};
        data.commodityCode = commodityCode;
//        YgmJsCommon.popups.loading();
    }

    //判断是否赠，惠，享，限，配Promotions
    function displayProductPromotions(promotions) {
        var html = "";
        if (promotions) {
            for (var i = 0; i < promotions.length; i++) {
                var flag = promotions[i].SaleFlag;
                if (flag == 1) {
                    html += '<li><span class="tit tit4">买即赠</span><span>' + promotions[i].SaleText + '</span></li>';
                }
                else if (flag == 2) {
                    html += '<li><span class="tit tit3">优惠券</span><span>' + promotions[i].SaleText + '</span></li>';
                }
                if (flag == 3) {
                    html += '<li><span class="tit tit1">超值限购</span><span>' + promotions[i].SaleText + '</span></li>';
                }
                else if (flag == 4) {
                    html += '<li><span class="tit tit2">手机专享</span><span>' + promotions[i].SaleText + '</span></li>';
                }
                else if (flag == 5) {
                    html += '<li><span class="tit tit5">限时配送</span><span>' + promotions[i].SaleText + '</span></li>';
                }
                else if (flag == 6) {
                    html += '<li><span class="tit tit6">闪电购</span>' + promotions[i].SaleText + '</span></li>';
                }
            }
        }
        return html;
    }

    //是否显示原价
    function displayOriginalPrice(dataRow) {
        var showOriginalPrice = dataRow.ShowOriginalPrice;
        if (showOriginalPrice == true) {
            return '￥' + parseFloat(dataRow.OriginalPrice).toFixed(2) + '';
        }
        return "";
    }

    //商品的状态显示
    function displayProductState(state) {
        var html = '<a class="btn-cart" id="btnCart">加入购物车</a>';
        if (state == 2 || state == 4) {//下架
            html = '<a class="out_of_stock">下架</a>';
        }
        else if (state == 128) {//无货
            html = '<a class="out_of_stock">无货</a>';
        }
        return html;
    }
</script> 
  <footer class="footer"> 
   <a class="" href="index.html" id="index"><span class="home">首页</span>首页</a> 
   <a href="cat.html" id="category" class="current"><span class="catalog">分类</span>分类</a> 
   <a href="cart.html" id="cart"> <span class="shopping">购物车<font id="fCartProductTotalCount" class="badge" style="display: none;"></font></span>购物车 </a> 
   <a href="member_index.html" id="my"><span class="my">我的易果</span>我的易果</a> 
  </footer> 
  <div data-backdrop="static" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="divMyCity" class="modal" style="display: none;"> 
   <div role="document" class="modal-dialog"> 
    <div id="divCityContent" class="modal-content"> 
     <div style=" display:block;" class="gpstips"> 
      <a> <em class=" icon icon_gps"> </em> 亲，请先选择您的收货城市 <em class=" icon icon_arrowright"> </em> </a> 
     </div> 
    </div> 
   </div> 
  </div> 
  <script type="text/javascript">
        var _wx_JsConfig = {};
        _wx_JsConfig.appid = "wx0d4f4f0e0bada80e";
        _wx_JsConfig.imgUrl = "http://img02.yiguo.com/e/web/150930/00783/155744/wxlogo.jpg";
        _wx_JsConfig.title = "易果生鲜触屏版";
        _wx_JsConfig.content = "全国首家生鲜专业电商，全球优质生鲜产地直供，全年无休生鲜冷链配送";
        _wx_JsConfig.timeLineLink = "http://weixin.m.yiguo.com";

        _wx_JsConfig.timestamp = "";
        _wx_JsConfig.nonceStr = "";
        _wx_JsConfig.signature = "";

        $(function () {
            YgmJsCommon.domain = "yiguo.com";
            var jsonWxCfg = decodeURIComponent("%7b%22appId%22%3anull%2c%22timestamp%22%3a%221445765498%22%2c%22nonceStr%22%3a%221309023909%22%2c%22signature%22%3a%22609dd0824b04c915c4bc239bf017f73a12d23468%22%2c%22url%22%3a%22http%3a%2f%2fweixin.m.yiguo.com%2fproduct%2f156159.html%22%2c%22jsapi_ticket%22%3a%22bxLdikRXVbTPdHSM05e5u_n3yqdZ_9Pt0dvnbtzvrXZ2Bps91PjRajJdScVYkXWafhoi6zfSwxWok0rXn11cmQ%22%7d");
            var wxJsCfg = JSON.parse(jsonWxCfg);
            _wx_JsConfig.timestamp = wxJsCfg.timestamp;
            _wx_JsConfig.nonceStr = wxJsCfg.nonceStr;
            _wx_JsConfig.signature = wxJsCfg.signature;

            wx.config({
                //debug: true,
                appId: _wx_JsConfig.appid,
                timestamp: _wx_JsConfig.timestamp,
                nonceStr: _wx_JsConfig.nonceStr,
                signature: _wx_JsConfig.signature,
                jsApiList: [
                    'onMenuShareTimeline',
                    'onMenuShareAppMessage'
                ]
            });

            myShare();

            getCartCount();

            showSelectedCityDialog();
        })

        function myShare() {
            wx.ready(function () {
                //分享朋友圈
                wx.onMenuShareTimeline({
                    title: _wx_JsConfig.title,
                    desc: _wx_JsConfig.content, // 分享描述
                    link: _wx_JsConfig.timeLineLink,
                    imgUrl: _wx_JsConfig.imgUrl,
                    trigger: function (res) {
                    },
                    success: function (res) {
                        dplus.track("分享到朋友圈");
                    },
                    cancel: function (res) {
                    },
                    fail: function (res) {
                    }
                });
                //分享朋友
                wx.onMenuShareAppMessage({
                    title: _wx_JsConfig.title,
                    desc: _wx_JsConfig.content,
                    link: _wx_JsConfig.timeLineLink,
                    imgUrl: _wx_JsConfig.imgUrl,
                    trigger: function (res) {
                    },
                    success: function (res) {
                        dplus.track("分享给朋友");
                    },
                    cancel: function (res) {
                    },
                    fail: function (res) {
                    }
                });
            });

        }

        //如果查询到CityCookie default=1，表示用户没有选择过城市，则需要弹出选择城市
        function showSelectedCityDialog() {
            var objCity = YgmJsCommon.getCityCookie();
            if (objCity != null && objCity.Default == 1) {
                $("#divMyCity").css('display', "");
                $("#divMyCity").modal('show');
                $("#divMyCity").click(function () {
                    window.location.href = "/Home/SelectCity";
                })
            }
            else {
                $("#divMyCity").css('display', "none");
            }
        }

        //返回商品数量显示在footer上
        function getCartCount() {
            var count = YgmJsCommon.getCartProductsTotalCount();
            if (count > 0) {
                $("#fCartProductTotalCount").css("display", "");
                $("#fCartProductTotalCount").html(count);
            }
            else {
                $("#fCartProductTotalCount").css("display", "none");
            }
            return count;
        }

        //设置云朵的位置
        $('#divMyCity').on('shown.bs.modal', function () {
            var win_width = $(this).find(".modal-dialog").width();
            var win_height = $(this).find(".modal-dialog").height();
            $(this).find(".modal-dialog").css({ "marginTop": String(-1 * win_height / 2) + "px", "marginLeft": String(-1 * win_width / 2) + "px" });

        });

        window.onload = function () {
            
        };
    </script> 
 </body>
</html>